ProximityPrompt¶
Inherits Dynamic
ProximityPrompt shows a floating, billboarded prompt when a player gets close, letting them interact by pressing (or holding) a key. It fires Triggered on the client that activated it. Position it in the world like any Dynamic.
Example usage:
local prompt = workspace.Chest.ProximityPrompt
prompt.ActionText = "Open"
prompt.ObjectText = "Treasure Chest"
prompt.HoldDuration = 1.5
prompt.Triggered:Connect(function(player)
print(player.Name .. " opened the chest")
end)
Properties¶
ActionText : string¶
The main line of text shown on the prompt (for example "Open").
ObjectText : string¶
An optional smaller line above the action text (for example the object's name). Empty hides it.
MaxActivationDistance : number¶
How close (in studs) a player must be for the prompt to appear and be usable.
HoldDuration : number¶
Seconds the key must be held to trigger. 0 means a single press triggers instantly. A progress ring is shown while holding.
Enabled : boolean¶
Whether the prompt is shown and can be triggered.
KeyboardKeyCode : string¶
The key the player presses to interact (for example "E", "F", "G"). Defaults to "E".
PromptScale : number¶
Visual size multiplier for the prompt billboard.
Events¶
Triggered¶
Parameters: ``
Fires on the local client when the player presses or finishes holding the key in range.